package edu.towson.cis.androidagile.helloworldlogin;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class LoginActivity extends Activity implements OnClickListener {
	protected Button vw_LoginButton;
	protected EditText vw_LoginText;
	protected EditText vw_PasswordText;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.login_screen);
        
        vw_LoginButton = (Button) findViewById(R.id.bu_login);
        vw_LoginText = (EditText) findViewById(R.id.et_login);
        vw_PasswordText = (EditText) findViewById(R.id.et_password);
        
        vw_LoginButton.setOnClickListener(this);
    }

	@Override
	public void onClick(View arg0) {
		if (arg0 == vw_LoginButton) {
			String login = vw_LoginText.getText().toString();
			String password = vw_PasswordText.getText().toString();
			if (password.equalsIgnoreCase("android")) {
				Intent helloAndroidIntent = new Intent(LoginActivity.this,HelloWorldActivity.class);
				helloAndroidIntent.putExtra("username", login);
				startActivity(helloAndroidIntent);
			}
		}
		
	}


    
}